package com.heima.Serivce.impl;


import com.heima.Serivce.WemediaCilent;
import com.heima.model.Admin.Dtos.ChannelDto;
import com.heima.model.Admin.Dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.WmNewsPageReqDto;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.pojos.WmNews;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
public class WemediaClientFallBackeFactroy implements FallbackFactory<WemediaCilent> {
    @Override
    public WemediaCilent create(Throwable throwable) {
        return new WemediaCilent() {
            @Override
            public ResponseResult GetSensitiveList(SensitiveDto sensitiveDto) {
                log.error(String.valueOf(throwable));
                 return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"获取数据失败");
            }

            @Override
            public ResponseResult GetChamnelList(ChannelDto channelDto) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"获取数据失败");
            }

            @Override
            public ResponseResult GetArticleList(WmNewsPageReqDto wmNewsPageReqDto) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"获取数据失败");
            }

            @Override
            public ResponseResult GetArticleById(Integer id) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"获取数据失败");
            }

            @Override
            public ResponseResult SaveArticle(WmNews wmNews) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"获取数据失败");
            }

            @Override
            public ResponseResult UpdateArticle(WmNews wmNews) {
                return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"获取数据失败");
            }
        };
    }
}
